package com.frejoys.service;


import com.alipay.easysdk.payment.common.models.AlipayTradeQueryResponse;
import com.alipay.easysdk.payment.common.models.AlipayTradeRefundResponse;
import com.frejoys.common.vo.pay.WxJsPayVo;
import com.github.binarywang.wxpay.bean.notify.SignatureHeader;
import com.github.binarywang.wxpay.bean.result.WxPayOrderQueryV3Result;
import jakarta.servlet.http.HttpServletRequest;

public interface PayService {

    /**
     * 获取HttpServlet请求中的请求头
     * @param request
     * @return
     */
    SignatureHeader wxSignatureHeader(HttpServletRequest request);

    /**
     * 发起Jsapi支付
     * @param domain 域名，不带后缀
     * @param description
     * @param openid
     * @param orderSn
     * @param price
     * @param currency
     * @param attach
     * @return
     */
    WxJsPayVo wxJsPay(String domain, String description, String openid, String orderSn, Integer price, String currency, String attach);

    /**
     * 发起H5支付
     * @param domain 域名，不带后缀
     * @param description
     * @param openid
     * @param orderSn
     * @param price
     * @param currency
     * @param attach
     * @return
     */
    WxJsPayVo wxH5Pay(String domain, String description, String openid, String orderSn, Integer price, String currency, String attach);

    /**
     * 微信退款
     * @param domain
     * @param orderSn
     * @param price
     * @param currency
     * @return
     */
    Boolean wxRefund(String domain, String orderSn, Integer price, String currency);

    /**
     * 获取微信订单信息
     * @param orderSn
     * @return
     */
    WxPayOrderQueryV3Result wxOrderInfo(String orderSn);

    /**
     * 获取微信订单是否支付： true 已支付， false 未支付
     * @param orderSn
     * @return
     */
    Boolean wxOrderPayResult(String orderSn);

    /**
     * 微信转款到个人钱包
     * @param openid
     * @param orderSn
     * @param money
     * @param desc
     * @return
     */
    Boolean wxTransferWallet(String openid, Long orderSn, Integer money, String desc);


    /**
     * 支付宝H5支付
     * @param domain
     * @param description
     * @param orderSn
     * @param price
     * @param attach
     * @return
     */
    String aliH5Pay(String domain, String description, String orderSn, String price, String attach);

    /**
     * 支付宝退款
     * @param orderSn
     * @param price
     * @return
     */
    Boolean aliRefund(String orderSn, String price);

    /**
     * 支付宝查询订单支付信息
     * @param orderSn
     * @return
     */
    AlipayTradeQueryResponse aliOrderInfo(String orderSn);

    /**
     * 支付宝查询订单是否已经支付
     * @param orderSn
     * @return true 已支付，false 未支付
     */
    Boolean aliOrderPayResult(String orderSn);

}
